<?php
/*
 * Creative Bulletin Board Generation 3
 * Version 1.0 Beta 1
 +------------------------------------
 * Login Application (Auth), Index/Form Module (Backend)
 * Started: 19 September, 2009 09:14 PM
 * Script version: 1.0
 +------------------------------------
 */

class module implements module_interface{
	public function returninitvars(){
		global $lang;
		$this->info["page_title"] = $lang->getByKey("admin.secure.home");
		$this->info["page_description"] = "";
		$this->info["module_version"] = "1.0";
		return $this->info;
	}

	public function construct(){ # call our initialize functions
	}
	
	private function getVersionStatus(){ # Get the version status... er.
		// Updaty
		// STUB: Get data from CF Master Server
		$data = "LATEST 40000 http://creativebb.net/coming_soon.php";
		// Now parse the data.
		$data = explode(" ", $data);
		$latest_real_version = intval($data[1]);
		if(CF_VERSION_REAL == $latest_real_version) $uptodate = 1;
		elseif(CF_VERSION_REAL > $latest_real_version) $uptodate = 2;
		else $uptodate = 0;
		return $uptodate;
	}
	
	public function run(){
		global $view, $lang, $db, $models;
		$view->writeIn( $view->inlineInfo($lang->getByKey("admin.secure.home.desc")));
		// Row 1: Security Alerts - CF Sec Bulletin (Coming Soon)
		$data1["config"] = (is_writable(CONF_FILE) ? $view->inlineError($lang->getByKey("admin.secure.config.worldw")) : "");
		$data1["version"] = ($this->getVersionStatus() == 0 ? $view->inlineError($lang->getByKey("update.available").
			$lang->getByKey("admin.secure.update")) : "");
		if(trim(implode("", $data1)) == "") $data1["extra"] = $view->inlineSuccess($lang->getByKey("admin.secure.alright"));
		else $data1["extra"] = $view->inlineWarning($lang->getByKey("admin.secure.oops"));
		$column1["left"] = $view->tablePadded($lang->getByKey("admin.secure.quickcheck"), $view->showTemplate("secChecks", $data1), "lock");
		$column1["right"] = "";
		$view->writeIn($view->showTemplate("column", $column1));
	}

	public function destruct(){}
}
